<template>
<h1>El-表单组件</h1>
  <h2>注册页面</h2>
  <el-form label-width="80" style="width: 500px;margin: 0 auto">

    <el-form-item label="用户名" >
      <el-input placeholder="请输入用户名" v-model="user.username"></el-input>
    </el-form-item>

    <el-form-item label="密码" >
      <el-input show-password placeholder="请输入密码" v-model="user.password"></el-input>
    </el-form-item>

    <el-form-item label="性别" >
  `   <!--      单选组-->
      <el-radio-group v-model:="user.gender">
        <el-radio-button  value="男" label="男"></el-radio-button>
        <el-radio-button  value="女" label="女"></el-radio-button>
      </el-radio-group>
    </el-form-item>

    <el-form-item label="所在地" >
      <el-select v-model:="user.city" placeholder="请输入你的城市">
        <el-option value="北京" label="北京"></el-option>
        <el-option value="武汉" label="武汉"></el-option>
        <el-option value="昆明" label="昆明"></el-option>
        <el-option value="上海" label="上海"></el-option>
      </el-select>
    </el-form-item>

    <el-form-item label="管理员">
      <el-switch v-model:="user.isAdmin" active-value="1" :inactive-value="0" />
    </el-form-item>

    <el-button type="success" @click="doAction()">注册</el-button>
  </el-form>
</template>

<script setup>
import {ref} from "vue";

const user = ref({username:'',password:'',gender:'',city:'',isAdmin:''})

const doAction = () => {
  // user.value.username = username.value
  // user.value.password = password.value
  // user.value.city = city.value
  // user.value.isAdmin = isAdmin.value
  // user.value.gender = gender.value
  console.log(user.value)
}

</script>

<style scoped>

</style>